import hmac
import hashlib
import base64
import time
# sign= BASE64(HMAC SHA256(appKey+timestamp,appsecret))
def generate_signature(app_key, timestamp, app_secret):
    message = app_key.encode('utf-8') + str(timestamp).encode('utf-8')
    secret = app_secret.encode('utf-8')
    signature = hmac.new(secret, message, hashlib.sha256).digest()
    encoded_signature = base64.b64encode(signature).decode('utf-8')
    return encoded_signature

app_key = "32344379"
app_secret = "021e9c4786d03245beea4ecb35bdb28b"
timestamp = int(time.time())
print('app_key:',app_key)
print('app_secret:',app_secret)
print('timestamp:',timestamp)
#timestamp = 1712736025

signature = generate_signature(app_key, timestamp, app_secret)
print("Signature:", signature)
